#include <stdio.h>
#include <unistd.h>
#include <math.h>
#include <sys/types.h>
#include <linux/unistd.h>

int do_pi(int p){
    double mypi,h,sum,x;
    long long n,i;
    n = 500000000000;
    h = 1.0/n;
    sum=0.0;
    for (i = 1; i <= n; i+=1 ) {
        x = h * (i - 0.5);
        sum += 4.0 / (1.0 + pow(x,2));
    }
    mypi = h * sum;
    return 0;
}
int bk()
{
    do_pi(0);
}
int ak()
{
    double mypi,h,sum,x;
    long long n,i;
    n = 500000;
    h = 1.0/n;
    sum=0.0;
    for (i = 1; i <= n; i+=1 ) {
        x = h * (i - 0.5);
        sum += 4.0 / (1.0 + pow(x,2));
    }
    mypi = h * sum;
    bk();
}
int b()
{
    do_pi(1);
}
int a()
{
    b();
}

int main()
{
    pid_t pid;
    printf("pid: %d\n", getpid());
    pid = fork();
    if (pid == 0) {
        ak();
    }
    a();
    return 0;
}
